<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <style>
        * {
            margin: 0;
            padding: 0;
        }
        .box {
            width: 500px;
            height: 500px;
            background-color: #777777;
            overflow: hidden;
        }
        .box2 {
            width: 200px;
            height: 200px;
            margin-left: 50px;
            margin-top:50px;
            background-color: #7CB609;
        }
    </style>
</head>
<body>
<div class="box">
    <div class="box2">

    </div>
</div>
</body>
<script>
    var box = document.getElementsByClassName('box')[0];
    var box2 = document.getElementsByClassName('box2')[0];
    box.onmouseenter = function () {
        console.log(1);
    };
    box2.onmouseover = function () {
        console.log(2);
    };
</script>
</html>